#!/user/bin/env jython
# -*- coding: utf-8 -*-

from java.io import *
import JcsvWriter



class JCsv:
	def __init__(self):
	
		pass
		
	def firstQuery(self, listValues, result, establishment, year):
		
		f = FileOutputStream("query1.csv")

				
		PrintStream(f).println (JcsvWriter.csvWriteRow(['Teacher', 'Establishment', 'Year', 'Result']))
		
		
		controlValue = 0
		
		for row in listValues:
			if controlValue == 0:
				
				PrintStream(f).println (JcsvWriter.csvWriteRow([row, establishment, year, result]))
				controlValue = 1
			else:
				PrintStream(f).println(JcsvWriter.csvWriteRow([row]))
				
		
		

	def query2(self, listValues, result, establishment, year, categorie):
		
		f = FileOutputStream("query2.csv")

				
		PrintStream(f).println (JcsvWriter.csvWriteRow(['Teacher', 'Establishment', 'Year', 'Categorie' 'Result']))
		
		
		controlValue = 0
		
		for row in listValues:
			if controlValue == 0:
				
				PrintStream(f).println (JcsvWriter.csvWriteRow([row, establishment, year, categorie, result]))
				controlValue = 1
			else:
				PrintStream(f).println(JcsvWriter.csvWriteRow([row]))
				




	def query3(self, listValues, result, establishment, year, degree):
		f = FileOutputStream("query3.csv")

				
		PrintStream(f).println (JcsvWriter.csvWriteRow(['Teacher', 'Establishment', 'Year', 'Degree', 'Result']))
		
		
		controlValue = 0
		
		for row in listValues:
			if controlValue == 0:
				
				PrintStream(f).println (JcsvWriter.csvWriteRow([row, establishment, year, degree, result]))
				controlValue = 1
			else:
				PrintStream(f).println(JcsvWriter.csvWriteRow([row]))
		pass
